package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConComplaintUpload;
import com.htgd.gardenexpo.dao.GeConComplaintUploadDao;
import com.htgd.gardenexpo.service.GeConComplaintUploadService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConComplaintUpload)表服务实现类
 *
 * @author makejava
 * @since 2021-06-24 15:25:17
 */
@Service("geConComplaintUploadService")
public class GeConComplaintUploadServiceImpl implements GeConComplaintUploadService {
    @Resource
    private GeConComplaintUploadDao geConComplaintUploadDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public GeConComplaintUpload queryById(Integer id) {
        return this.geConComplaintUploadDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConComplaintUpload> queryAllByLimit(int offset, int limit) {
        return this.geConComplaintUploadDao.queryAllByLimit(offset, limit);
    }

    @Override
    public List<GeConComplaintUpload> queryByComplaintId(int id) {
        return this.geConComplaintUploadDao.queryByComplaintId(id);
    }

    /**
     * 新增数据
     *
     * @param geConComplaintUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConComplaintUpload insert(GeConComplaintUpload geConComplaintUpload) {
        this.geConComplaintUploadDao.insert(geConComplaintUpload);
        return geConComplaintUpload;
    }

    /**
     * 修改数据
     *
     * @param geConComplaintUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConComplaintUpload update(GeConComplaintUpload geConComplaintUpload) {
        this.geConComplaintUploadDao.update(geConComplaintUpload);
        return this.queryById(geConComplaintUpload.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.geConComplaintUploadDao.deleteById(id) > 0;
    }

    @Override
    public boolean deleteByComplaintId(Integer id) {
        return this.geConComplaintUploadDao.deleteByComplaintId(id) > 0;
    }

    @Override
    public boolean deleteByIds(String[] id,int cid) {
        return this.geConComplaintUploadDao.deleteByIds(id,cid) > 0;
    }
}
